package models;

import java.util.LinkedList;
import java.util.List;

import views.MultipleChoiceQView;
import views.TrueFalseQView;
import controllers.MultipleChoiceQController;
import controllers.TrueFalseQController;

import mvc.AbstractView;

public class MultipleChoiceQuestion extends AbstractQuestion
{
	public MultipleChoiceQuestion(String name, String caption)
	{
		super(name, caption);
		choiceSet = new LinkedList<String>();
	}
	
	public MultipleChoiceQuestion(String name, String caption, double points)
	{
		super(name, caption, points);
		choiceSet = new LinkedList<String>();
	}

	@Override
	public AbstractView createView()
	{
		if(itsIObservers.size() > 0)
		{
			return null;
		}
		
		MultipleChoiceQController controller = new MultipleChoiceQController(this);
		AbstractView view  = new MultipleChoiceQView(controller, this);
		this.attach(view);
		return view;
	}

	public void addChoice(String choice)
	{
		if(!choiceSet.contains(choice))
		{
			choiceSet.add(choice);
		}
	}
	
	public void removeChoice(String choice)
	{
		if(choiceSet.contains(choice))
		{
			choiceSet.remove(choice);
		}
	}
	
	public List<String> getChoiceList()
	{
		return  new LinkedList<String>(choiceSet);
	}
	
	private List<String> choiceSet;

	@Override
	public String getCategory()
	{
		return new String("Multiple choice question");
	}
}